exports.getOpenId = function(req, res) {

	//获取restful参数
	var restfulParams = req.routeInfo.restfulParams;

	//code
	var code = restfulParams.code;

	//最终结果
	var resultData = {};

	//任务流创建
	async.waterfall([


		//获取用户临时openid
		function(cb) {
			//			var openidUrl = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=wx9d7965ae361cc36b&secret=6439b39616563237e0707d0d0fc09889&code=" + code + "&grant_type=authorization_code";
			var openidUrl = "http://"+config.publicConfig.SERVER_IP+"/weixinDemo/getUserAccessToken.php?code=" + code;
//			var openidUrl = "http://demo2.artmofang.com/weixinDemo/getUserAccessToken.php?code=" + code;
			R.SEND_HTTP(
				req, {
					url: openidUrl,
					method: 'GET'
				},
				function(err, data) {

					//console.log('临时openid');
					console.log(data);

					if(err) {
						return RES.response(res, false, "临时openid获取失败");
					}

					//判断是否请求成功
					if(data.errcode) {
						return RES.response(res, false, data.errmsg);
					}

					resultData = data;

					cb();

				}
			);

		},

	], function(err, result) {

		//返回最终拼接结果
		RES.response(res, true, resultData);

	});

}